



    <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <input id="c-id"  class="form-control" name="row[id]" type="hidden" value="{$ids}">
        <input id="c-product_id" disabled class="form-control" name="row[product_id]" type="hidden" value="{$row.productname_id|htmlentities}">
        <input id="c-factory_id" disabled class="form-control" name="row[factory_id]" type="hidden" value="{$row.factory_id|htmlentities}">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Product_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-product_code" disabled class="form-control" name="row[product_code]" type="text" value="{$row.product_code|htmlentities}">
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('产品名称')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-product_name" disabled class="form-control" name="row[product_name]" type="text" value="{$row.product_name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('所属工厂')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-factory_title" disabled class="form-control" name="row[factory_title]" type="text" value="{$row.factory_title|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('工厂收件人')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-factory_name" disabled class="form-control" name="row[factory_name]" type="text" value="{$row.factory_name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('电话')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-factory_phone" disabled class="form-control" name="row[factory_phone]" type="text" value="{$row.factory_phone|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('地址')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-factory_address" disabled class="form-control" name="row[factory_address]" type="text" value="{$row.factory_address|htmlentities}">
        </div>
    </div>
    {if $admin_type != 3}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-image"  class="form-control" size="50" name="row[image]" type="text" value="{$row.image|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-image" class="btn btn-danger faupload" data-input-id="c-image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp,video/mp4,video/flv" data-multiple="true" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-image" class="btn btn-primary fachoose" data-input-id="c-image" data-mimetype="image/*,video/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-image"></ul>
        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('用户说明')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-user_content" class="form-control editor" rows="5" name="row[user_content]" cols="50">{$row.user_content|htmlentities}</textarea>
        </div>
    </div>
    {if $admin_type != 3}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('售后负责人')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-work_admin_id" data-source="work/admin/index" class="form-control selectpage" name="row[work_admin_id]" type="text" value="{$row.work_admin_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('选择渠道')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-channel_id" data-rule="required" data-source="channel/index" class="form-control selectpage" name="row[channel_id]" type="text" value="{$row.channel_id|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Order_image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-order_image" class="form-control" size="50" name="row[order_image]" type="text" value="{$row.order_image|htmlentities}">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="faupload-order_image" class="btn btn-danger faupload" data-input-id="c-order_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-order_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-order_image" class="btn btn-primary fachoose" data-input-id="c-order_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-order_image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-order_image"></ul>
        </div>
    </div>
    {/if}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('是否自动审核')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="radio">
                {foreach name="isStatuslList" item="vo"}
                <label for="row[isstatus]-{$key}"><input id="row[isstatus]-{$key}" name="row[isstatus]" type="radio" value="{$key}" {in name="key" value="2"}checked{/in} /> {$vo}</label>
                {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('店铺')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-shop_name" class="form-control" name="row[shop_name]" type="text" value="{$row.shop_name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('订单号')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-order_code" class="form-control" name="row[order_code]" type="text" value="{$row.order_code|htmlentities}">
        </div>
    </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('备注')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-remarks"  class="form-control" name="row[remarks]" type="text"  value="{$row.remarks|htmlentities}">
            </div>
        </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('收件人姓名')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-res_receiver" class="form-control" name="row[res_receiver]" type="text" value="{$row.res_receiver|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('收件人手机号')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-res_mobile" class="form-control" name="row[res_mobile]" type="text" value="{$row.res_mobile|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('收件人地址')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-res_address" class="form-control" name="row[res_address]" type="text" value="{$row.res_address|htmlentities}">
        </div>
    </div>
        {if $confirm_time > 0}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('确认收货时间')}:</label>
        <div class="col-xs-12 col-sm-8">

            <input class="form-control datetimepicker"
                   data-date-format="YYYY-MM-DD HH:mm:ss"
                   data-use-current="true"
                   id="c-confirm_time"
                   type="text"
                   name="row[confirm_time]"
                   value="{$row.confirm_time|htmlentities}"
                   placeholder="请选择时间">
        </div>
    </div>
        {else/}
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('确认收货时间')}:</label>
            <div class="col-xs-12 col-sm-8">

                <input class="form-control datetimepicker"
                       data-date-format="YYYY-MM-DD HH:mm:ss"
                       data-use-current="true"
                       id="c-confirm_time"
                       type="text"
                       name="row[confirm_time]"
                       value=""
                       placeholder="请选择时间">
            </div>
        </div>
        {/if}

        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('购买时间')}:</label>
            <div class="col-xs-12 col-sm-8">

                <input class="form-control datetimepicker"
                       data-date-format="YYYY-MM-DD HH:mm:ss"
                       data-use-current="true"
                       id="c-pay_time"
                       type="text"
                       name="row[real_pay_time]"
                       placeholder="请选择时间"
                       value="{$row.real_pay_time|htmlentities}"
                >
            </div>
        </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Detection_content')}:</label>
            <div class="col-xs-12 col-sm-8">
                <textarea id="c-detection_content" class="form-control editor" rows="5" name="row[detection_content]" cols="50">{$row.detection_content|htmlentities}</textarea>
            </div>
        </div>
        {if $damage_reason != 1}
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('问题类型')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select  id="c-problem" class="form-control selectpicker" multiple="" name="row[problem][]">
                    <!--{foreach name="problemList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.problem"}selected{/in}>{$vo}</option>
                    {/foreach}-->
                    {foreach name="parentList_zl" item="vo"}
                    <option   value="{$key}" {in name="key" value="$row.problem"}selected{/in}>{$vo.name}</option>
                    {/foreach}

                </select>
            </div>
        </div>
        {/if}
        {if $damage_reason == 1}
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('工厂检查维修状态')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select  id="c-factory_status" class="form-control selectpicker" multiple="" name="row[factory_status][]">
                    <!--{foreach name="problemList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.problem"}selected{/in}>{$vo}</option>
                    {/foreach}-->
                    {foreach name="repair_fzl" item="vo"}
                    <option   value="{$key}" {in name="key" value="$row.factory_status"}selected{/in}>{$vo.name}</option>
                    {/foreach}

                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('问题')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select  id="c-problem" class="form-control selectpicker" multiple="" name="row[problem][]">
                    <!--{foreach name="problemList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.problem"}selected{/in}>{$vo}</option>
                    {/foreach}-->
                    {foreach name="parentList_fzl" item="vo"}
                    <option   value="{$key}" {in name="key" value="$row.problem"}selected{/in}>{$vo.name}</option>
                    {/foreach}

                </select>
            </div>
        </div>
        {/if}
        {if $damage_reason != 1}
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('工厂检查维修状态')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select  id="c-factory_status" class="form-control selectpicker" multiple="" name="row[factory_status][]">
                    <!--{foreach name="problemList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.problem"}selected{/in}>{$vo}</option>
                    {/foreach}-->
                    {foreach name="repair_zl" item="vo"}
                    <option   value="{$key}" {in name="key" value="$row.factory_status"}selected{/in}>{$vo.name}</option>
                    {/foreach}

                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('问题')}:</label>
            <div class="col-xs-12 col-sm-8">
                <select  id="c-problem" class="form-control selectpicker" multiple="" name="row[problem][]">
                    <!--{foreach name="problemList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.problem"}selected{/in}>{$vo}</option>
                    {/foreach}-->
                    {foreach name="parentList_zl" item="vo"}
                    <option   value="{$key}" {in name="key" value="$row.problem"}selected{/in}>{$vo.name}</option>
                    {/foreach}

                </select>
            </div>
        </div>
        {/if}
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('用户备注')}:</label>
            <div class="col-xs-12 col-sm-8">
                <textarea id="c-problem_content" class="form-control editor" rows="3" name="row[problem_content]" cols="30">{$row.problem_content|htmlentities}</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('Cost_content')}:</label>
            <div class="col-xs-12 col-sm-8">
                <textarea id="c-cost_content" class="form-control editor" rows="3" name="row[cost_content]" cols="30">{$row.cost_content|htmlentities}</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('用户支付凭证')}:</label>
            <div class="col-xs-12 col-sm-8">
                <div class="input-group">
                    <input id="c-voucher" class="form-control" size="50" name="row[voucher]" type="text" value="{$row.voucher|htmlentities}">
                    <div class="input-group-addon no-border no-padding">
                        <span><button type="button" id="faupload-voucher" class="btn btn-danger faupload" data-input-id="c-voucher" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-voucher"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                        <span><button type="button" id="fachoose-voucher" class="btn btn-primary fachoose" data-input-id="c-voucher" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                    </div>
                    <span class="msg-box n-right" for="c-voucher"></span>
                </div>
                <ul class="row list-inline faupload-preview" id="p-voucher"></ul>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('用户快递公司')}:</label>
            <div class="col-xs-12 col-sm-8">

                <select  id="c-level" class="form-control selectpicker" name="row[user_shipper_id]">
                    {foreach name="shipperList" item="vo"}
                    <option value="{$key}" {in name="key" value="$row.user_shipper_id"}selected{/in}>{$vo}</option>
                    {/foreach}
                </select>

            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('用户物流单号')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-user_shipper_code" class="form-control"  name="row[user_shipper_code]" type="text" value="{$row.user_shipper_code|htmlentities}">
            </div>
        </div>
        <div class="form-group row">
            <label class="control-label col-xs-12 col-sm-2">{:__('费用项')}:</label>
            <table   class="table table-striped table-bordered table-hover table-nowrap" id="linetable"  style="width: 80%;margin-left: 50px">
                <thead>
                <tr>
                    <th>工厂<span style="color:red;">*</span></th>
                    <th>渠道</th>
                    <th>费用项</th>
                    <th>工厂收取费用</th>
                    <th>心喜阅费用</th>
                    <th>操作</th>
                </tr>
                </thead>

                <tbody class="lyj_tbody">

                </tbody>
                <tbody>
                <!--name中<%=name%>表示的是data-template为此地的id值linedetail,对应的data-name的值linedetail-->
                <script id="linedetail" type="text/html" name="linedetail">
                    <tr class="active">


                        <td>
                            <input type="text" readonly id="factory_title<%=index+1%>" class="form-control"  data-line="<%=index+1%>" name="<%=name%>[<%=index%>][factory_title]"/>
                        </td>
                        // 料号名称
                        <td>
                            <input type="text" readonly  class="form-control" id="product_name<%=index+1%>" name="<%=name%>[<%=index%>][product_name]"  />
                        </td>
                        // 规格型号
                        <td>
                            <input type="text" readonly class="form-control" id="costmode_name<%=index+1%>" name="<%=name%>[<%=index%>][costmode_name]"  />
                        </td>
                        // 单位
                        <td>
                            <input type="text" readonly onblur = "cost_money()" class="form-control" id="cost_money<%=index+1%>" name="<%=name%>[<%=index%>][cost_money]" style="width: 100px"/>
                        </td>
                        <td>
                            <input type="text" readonly onblur = "cost_money()" class="form-control" id="real_money<%=index+1%>" name="<%=name%>[<%=index%>][real_money]" style="width: 100px"/>
                        </td>
                        <td>
                            <span class="btn btn-sm btn-danger btn-removeline"><i class="fa fa-times"></i></span>
                        </td>
                    </tr>
                </script>


                </tbody>
                <tr>
                    {if $row.status > 5}
                    <td>
                        <!--<span data-url="cost/select?product_id=" class="form-control fachoosetable" data-line="<%=index+1%>">选择</span>-->
                    <td colspan="1"><a href="javascript:;" class="btn btn-sm btn-success fachoosetable"><i class="fa fa-plas"></i>选择</a></td>
                    </td>
                    {/if}
                </tr>
            </table>
        </div>
        {if $row.status == 100}
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('是否留在工厂')}:</label>
            <div class="col-xs-12 col-sm-8">
                {:build_radios('row[is_liugc]', ['2'=>__('否'),'1'=>__('是')])}
            </div>
        </div>
        {/if}
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('工厂收取费用')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-cost"  class="form-control" step="0.01" name="row[cost]" type="number" value="{$row.cost|htmlentities}">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('心喜阅费用')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-real_cost" class="form-control" name="row[real_cost]" type="number" value="{$row.real_cost|htmlentities}">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('售后客服确认维修状态')}:</label>
            <div class="col-xs-12 col-sm-8">
                <input id="c-sales_status"  class="form-control"  name="row[sales_status]" type="text" value="{$row.sales_status|htmlentities}">
            </div>
        </div>
        {if $row.status > 6}
        <div class="form-group">
            <label class="control-label col-xs-12 col-sm-2">{:__('确认检测结果时间')}:</label>
            <div class="col-xs-12 col-sm-8">

                <input class="form-control datetimepicker"
                       data-date-format="YYYY-MM-DD HH:mm:ss"
                       data-use-current="true"
                       id="c-confirmdetection_time"
                       type="text"
                       name="row[confirmdetection_time]"
                       placeholder="请选择时间"
                       value="{$row.confirmdetection_time|htmlentities}"
                >
            </div>
        </div>
        {/if}
</form>
<script type="text/javascript">
    // === 设置分数上限
    function cs (price) {

        console.log("进入方法","number =",price.value);
        const moment = require('moment');
        var max_integral= moment().format('YYYY-MM-DD HH:mm:ss');
        $("#c-confirm_time").val(max_integral)
    }
    function cost_money () {
        var len = $('#linetable tr').length;
        console.info(len);
        var cost_money_sun = 0;
        for (var i = 1; i < len-1; i++) {

            var checkbox = document.getElementById('checkbox'+i);
            var isChecked = checkbox.checked;
            console.log("checkbox"+isChecked); // true表示选中，false表示未选中
            var cost_money = $("#cost_money"+i).val();
            console.log("cost_money"+cost_money);
            if(isChecked == true){
                cost_money_sun = Number(cost_money_sun) + Number(cost_money);
            }

            /*$('#linetable tr:eq(' + i + ') td:first').find('input').val(i);*/
            //查找id为table的表格内索引为i的行中的第一个单元格，然后将索引i设置为文本内容。
            //tr:eq(' + i + ') 是一个用于选择HTML元素的jQuery选择器，意思是选取序号为i的表格行（table row）。
        }

        $('#c-cost').val(cost_money_sun);
    }
</script>
